pub mod file_io;

use std::path::PathBuf;

use crate::errors::Result;
use self::file_io::FileIo;

pub trait IoManager: Send + Sync {
    fn read(&self, buf: &mut [u8], offset: u64) -> Result<usize> ;

    fn write(&self, buf: &[u8]) -> Result<usize> ;

    fn sync(&self) -> Result<()> ;

}

pub fn new_io_manager(buf: PathBuf) -> Result<impl IoManager> {
    FileIo::new(buf)
}